import 'package:example_package1/example_package1.dart';
import 'package:example_package1/util/widget_util.dart';
@RikiArgumentImport()
import 'package:flutter/material.dart';
import 'package:riki_router/riki_router.dart';

@RikiRoute(
  name: '/package1/2',
  routeName: 'package2页面',
  pageRouteType: PageRouteType.cupertino,
)
class Package1_2Page extends StatelessWidget {
  const Package1_2Page({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    RikiPage? route = RikiRouterDelegate.of(context).find(this);
    return Scaffold(
      appBar: buildAppBar('PACKAGE 1_2'),
      body: ListView(
        children: [
          Container(
            alignment: Alignment.center,
            height: 44,
            child: Text(route?.routeName ?? ''),
          ),
          buildListTile('跳转PACKAGE2', () {
            RikiRouterDelegate.of(context).pushUri('/package/2');
            RikiMiddleware.instance.fire(RikiMiddlewareEventType('PACKAGE1_2'), '发送了事件');
          }),
          buildListTile('返回首页跳转DEMO3', () {
            RikiRouterDelegate.of(context)
                .pushUriAndRemoveUntilWithNamed('/demo/3?arg={\"arg1\":\"1\",\"arg2\":1,\"arg3\":true,\"arg4\":[\"1\",\"2\",\"3\"],\"arg5\":{\"1\":1,\"2\":\"测试\",\"3\":true}}', '/');
          }),
        ],
      ),
    );
  }
}
